package cn.da.shuai.cool.ai.search.client.controller;

import cn.da.shuai.cool.ai.search.client.assistant.Assistant;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RequiredArgsConstructor
@RestController
@RequestMapping("/ai")
public class AIController {

    private final Assistant assistant;

    @GetMapping(value = "/chat", produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestParam("prompt") String prompt) {
        // 实现聊天功能，返回结果
        return assistant.chat(1, prompt);
    }
}
